package gui.tradeoptions;

import java.util.ArrayList;
import java.util.List;

import javax.swing.table.AbstractTableModel;

import commondata.TradeOptionStruct;

public class TradeOptionsTableModel extends AbstractTableModel {

	/**
	 * 
	 */
	private static final long serialVersionUID = -3684241697666249833L;

	List<TradeOptionStruct> tradeOptions = new ArrayList<TradeOptionStruct>();

	private static final int COLUMN_COUNT = 2;

	public int getColumnCount() {

		return COLUMN_COUNT;
	}

	public int getRowCount() {

		return tradeOptions.size();
	}

	public Object getValueAt(int row, int col) {

		if (col == 0) {
			return row + 1;
		}
		return " " + tradeOptions.get(row).getSecondTeam().getTeamName();
	}

	@Override
	public boolean isCellEditable(int arg0, int arg1) {

		return false;
	}

	@Override
	public String getColumnName(int col) {

		if (col == 0) {
			return "Order";
		}
		return "Trade-Mate Team";
	}

	public List<TradeOptionStruct> getTradeOptions() {
		return tradeOptions;
	}

	public void setTradeOptions(List<TradeOptionStruct> tradeOptions) {
		this.tradeOptions = tradeOptions;
		fireTableDataChanged();
	}
}
